require("../util.js");
require("../component/components.js");
// require("../component/purchaseHeader.js");
// require("../component/footer.js");
require("../../jsMt/util.js");
var userInfo=JSON.parse(sessionStorage.getItem("userInfo"));
if(!userInfo){
    location.href="/loginIndex"
}
var vm = new Vue({
    el:"#activityEnd",
    data:{
        type:"",
        orderNumber:"",
        burstList:{},
        user:{}
    },
    mounted:function(){
        this.searchObject = this.getQueryStringArgs();
        this.orderNumber=this.searchObject&&this.searchObject.orderNumber;
        this.type=this.searchObject&&this.searchObject.type;
        if(this.type==1||this.type==2){
            this.luckyBurstDetail();
        }

    },
    methods:{
        //后退
        getBack:function(){
            if(this.type==3){
                location.href="/purchase/burstingActivity?type=1";
            }else if(this.type==4){
                location.href="/telLogin?type=1";
            }else{
                location.href="/purchase/burstingActivity?type=1"
            }

        },
        bgimg:function(url){
            url = url?url:"";
            return {
                "background-image":'url("'+url+'"),url("")'
            }
        },
        /*获取查询字符对象*/
        getQueryStringArgs: function () {
            //取得查询字符串并去掉开头的问号
            var qs = (location.search.length > 0 ? location.search.substring(1) : ""),
                args = {},
                items = qs.length ? qs.split("&") : [],
                item = null,
                name = null,
                value = null,
                len = items.length;
            for (var i = 0; i < len; i++) {
                item = items[i].split("=");
                name = item[0];
                value = item[1];
                if (name.length) {
                    args[name] = value;
                }
            }
            return args;
        },
        //爆款优惠-详情
        luckyBurstDetail:function(){
            var that=this,data;
            data={
                loginUid:userInfo.id,
                orderNumber:that.orderNumber
            };
            this.ajax({url:"/purchase/luckyBurstDetail",data:data,dataType:"json",method:"post"},function(b){
                if(b.json.code==0&&b.json.data){
                    that.burstList=b.json.data;
                    // if(that.burstList.state==1){  //成功
                    //     that.getNext(5);
                    // }else if(that.burstList.state==0){ //失败
                    //     //that.getNext(7);
                    // }
                    that.user=that.burstList.u;
                    // that.typeId=that.burstList.userId;
                    // that.compareDate(that.burstList);
                    // console.log(that.number)
                    // that.lNumber=that.burstList.advs.length;
                    // that.coverImgSrc=that.burstList.advs[that.number].coverImgSrc;
                    // that.luckyBurstAdvId=that.burstList.advs[that.number].luckyBurstAdvId;
                    // getPlayer(that.burstList.advs[that.number]);
                    // // that.burstList.list=that.burstList.list;
                    // // that.getLuckyBurstList();
                }else{
                    vm.$refs.prompt.toast("获取详情失败！");
                }
            });
        },
        getNext:function(type){
            if(type==1){
                location.href="/happyi/myCoupon";
            }else if(type==2){
                location.href="/purchase/goodsDetails?type=1&productId="+this.burstList.id
            }
        }
    }
});